home *** CD-ROM | disk | FTP | other *** search
- /*
- mono.c
-
- */
-
-
- #include <stdio.h>
- #include <conio.h>
- #include <mem.h>
- #include <stdarg.h>
- #include <string.h>
- #include <dos.h>
-
-
-
- void mprintf(char *format, ...);
- void mono(char *message);
- static void scroll(void);
-
-
- #if 0
- void main(void){
- int i;
-
- printf("This is the active screen...");
- for(i=0;i<12;i++){
- getch();
-
- mono("art was here");
- mono(" mono.exe copyright (C) 1989 Art Shipman & Art_Was_Here");
- mono("one more message line, and");
- mono("another, and");
- mono("Art's going now...");
- printf("and still active\n");
-
- mprintf("%d plus %d equals %d",2,2,5);
- }
- }/*main*/
- #endif
-
-
-
- void mprintf(char *format, ...){
- va_list argptr;
- char buf[100];
-
- va_start(argptr, format);
- vsprintf(buf,format,argptr);
- va_end(argptr);
-
- mono(buf);
- }
-
-
-
- void mono(char *message){
- static unsigned segment = 0xB000;
- static unsigned offset = 0;
-
- char *blank=" ";
- int i; int j;
- int l=strlen(message);
-
- if (segment==0xB000) /*clear the screen*/
- {
- for(i=0;i<25;i++)
-
- { for(j=0; j<160; j++)
- { pokeb(segment, j++, blank[0] );
- pokeb(segment, j, 7);
- }
- segment+=10;
- }
- segment=0xB000;
- }
-
-
-
- for(i=0;i<l;i++) /*display a line*/
- {
- pokeb(segment, offset++, message[i] );
- offset++;
- }
- segment+=10; offset=0;
- if (segment-0xB000 >240)
- {
- scroll();
- segment-=10;
- }
- }
-
-
- static void scroll(void){
- size_t lin = 80*2;
- unsigned segment = 0xB000;
- int i;
- char *blank=" ";
-
- for(i=1; i<25; i++)
- {
- movedata(segment,160,segment,0, lin );
- segment+=10;
- }
- for(i=0; i<160; i++)
- { pokeb(segment, i++, blank[0] );
- pokeb(segment, i, 7);
- }
-
-
- }